<template>
	<div>
		<!--基本信息-->
		<HyCard title="基本信息">
			<el-descriptions :column="3" border>
				<el-descriptions-item label="会议名称">{{ baseInfo?.meetingName || '--' }}</el-descriptions-item>
				<el-descriptions-item label="项目类别">{{ retrunResultByArr(baseInfo?.appCategory, app_category) }}</el-descriptions-item>
				<el-descriptions-item label="评审类型">{{ retrunResultByArr(baseInfo?.reviewType, review_type) }}</el-descriptions-item>
				<el-descriptions-item label="评审时间">{{ baseInfo?.reviewTime || '--' }}</el-descriptions-item>
				<el-descriptions-item label="预计评审耗时">{{
					baseInfo?.estimatedReviewTime ? baseInfo.estimatedReviewTime + '小时' : '--'
				}}</el-descriptions-item>
				<el-descriptions-item label="评委到场时间">{{ baseInfo?.arrivalTime || '--' }}</el-descriptions-item>
				<el-descriptions-item label="评审地点" span="3">{{ baseInfo?.reviewAddress || '--' }}</el-descriptions-item>
				<el-descriptions-item label="联系人">{{ baseInfo?.contactPerson || '--' }}</el-descriptions-item>
				<el-descriptions-item label="联系方式">{{ baseInfo?.contactInformation || '--' }}</el-descriptions-item>
			</el-descriptions>
		</HyCard>
		<!--本次抽取条件-->
		<HyCard title="本次抽取条件" class="Card">
			<el-descriptions :column="2" border>
				<el-descriptions-item label="管理类专家人数">{{ extractionMode?.expertManagerCount || 0 }}</el-descriptions-item>
				<el-descriptions-item label="技术类专家人数">{{ extractionMode?.expertTechnologyCount || 0 }}</el-descriptions-item>
				<el-descriptions-item label="所需行业领域">{{
					retrunResultByArr(extractionMode?.expertIndustryFields, industry_fields)
				}}</el-descriptions-item>
				<el-descriptions-item label="所需专业领域">{{
					retrunResultByArr(extractionMode?.expertProfessionalFields, professional_fields)
				}}</el-descriptions-item>
				<el-descriptions-item label="回避单位">{{ extractionMode?.expertAvoidanceUnits?.join(',') || '--' }}</el-descriptions-item>
			</el-descriptions>
			<!--回避专家表格-->
			<el-descriptions :column="1" border>
				<el-descriptions-item label="回避专家">
					<Table :tableDataColumn="tableDataColumn1" :tableData="extractionMode?.expertAvoidanceList || []"></Table>
				</el-descriptions-item>
			</el-descriptions>
			<div class="mt-3">
				<el-alert
					:closable="false"
					type="success"
					:description="`本次项目回避单位${extractionMode.expertAvoidanceUnits?.length || 0}家，回避专家${
						extractionMode.expertAvoidanceList?.length || 0
					}人`"
				/>
			</div>
		</HyCard>
		<!--抽取结果-->
		<HyCard title="抽取结果" class="Card">
			<el-descriptions :column="2" border>
				<el-descriptions-item label="抽取状态">{{ retrunResultByArr(extractionResult?.extractStatus, extract_status) }}</el-descriptions-item>
				<el-descriptions-item label="抽取结果">{{ extractionResult?.extractResult || '--' }}</el-descriptions-item>
				<el-descriptions-item label="结果说明">{{ extractionResult?.extractResultRemark || '--' }}</el-descriptions-item>
				<el-descriptions-item label="抽取时间">{{ extractionResult?.extractTime || '--' }}</el-descriptions-item>
			</el-descriptions>
		</HyCard>
		<!--评审项目-->
		<HyCard class="Card">
			<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
				<el-tab-pane v-for="(item, index) in tabList" :key="index" :label="item.label" :name="item.activeName">
					<Table :tableDataColumn="tableDataColumn2" :tableData="reviewAppList || []"></Table>
				</el-tab-pane>
			</el-tabs>
		</HyCard>
		<div class="bottom"></div>
	</div>
</template>

<script lang="ts" setup>
import HyCard from '/@/components/HyCard/index.vue';
import Table from '../Table/index.vue';
import { useDict } from '/@/hooks/dict';
import { retrunResultByArr } from '../../hooks/index';
import type { TabsPaneContext } from 'element-plus';
const { professional_fields, industry_fields, app_category, review_type, extract_status } = useDict(
	'professional_fields',
	'industry_fields',
	'app_category',
	'review_type',
	'extract_status'
);
const props: any = defineProps({
	basicNameInfoData: {
		type: Object,
		default: () => ({}),
	},
});
const baseInfo = ref({}); //基本信息
const extractionResult = ref({}); //抽取结果
const extractionMode = ref({}); //抽取条件
const reviewAppList = ref([]); //评审项目
const expertList = ref([]); //评审专家
const institutionList = ref([]); //评审机构
watch(
	() => props.basicNameInfoData,
	(val) => {
		if (val) {
			baseInfo.value = val.baseInfo;
			extractionMode.value = val.extractionMode;
			extractionResult.value = val.extractionResult;
			reviewAppList.value = val.reviewAppList;
		}
	}
);
const activeName = ref('first');
const tabList = ref([
	{
		label: '评审项目',
		activeName: 'first',
	},
	// {
	// 	label: '评审专家',
	// 	activeName: 'second',
	// },
	// {
	// 	label: '评审机构',
	// 	activeName: 'third',
	// },
]);
const handleClick = (tab: TabsPaneContext, event: Event) => {
	switch (tab?.paneName) {
		case 'first':
			break;
		default:
			// reviewAppList.value = [];
			break;
	}
};
//回避专家-表头
const tableDataColumn1 = ref([{ property: 'expertName', lable: '专家名称' }]);
//底部项目评审-表头
const tableDataColumn2 = ref([
	{ property: 'appName', lable: '项目名称' },
	{ property: 'belongField', lable: '所属领域' },
	{ property: 'responsibleDept', lable: '责任部门' },
	{ property: 'countyLeadDept', lable: '市级牵头部门' },
	{ property: 'designUnit', lable: '设计单位' },
	{ property: 'yearBudget', lable: '年度预算（万元）' },
]);
</script>

<style scoped lang="scss">
.Card {
	margin-top: 10px;
}
.bottom {
	height: 10px;
}
</style>
